<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>余额消费记录</title>
    <link rel="stylesheet" type="text/css" href="../../../../css/aui/aui.css" />
    <style>
        html,
        body {
            background: #f7f7f7;
        }

        .list_wrap {
            padding: 0.5rem;
        }

        .list_item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #fff;
            box-shadow: 0 0 3px #ccc;
            margin-bottom: 0.5rem;
            padding: 0.3rem 0.5rem;
            border-radius: 0.2rem;
        }

        .title {
            color: #333;
        }

        .time {
            color: #999;
        }

        .price {
            color: #0689FB;
        }
    </style>
</head>

<body>
    <div id="app">
        <div class="list_wrap">
            <div class="list_item" v-for="o in list">
                <div>
                    <div class="title">{{o.wallet_notes}}</div>
                    <div class="time">{{o.create_time}}</div>
                </div>
                <div class="price" style="color:#0689FB;"><span v-if="o.money>0">+</span>{{o.money}}</div>
            </div>
        </div>
    </div>
</body>
<script src="../../../../script/api.js" charset="utf-8"></script>
<script src="../../../../script/aui/aui-tab.js" charset="utf-8"></script>
<script src="../../../../script/common/jquery-3.3.1.min.js" charset="utf-8"></script>
<script src="../../../../script/common/common.js" charset="utf-8"></script>
<script src="../../../../script/common/config.js" charset="utf-8"></script>
<script src="../../../../script/common/vue.min.js" charset="utf-8"></script>
<script>
    apiready = function() {
        api.parseTapmode();
        vm.init();
    }

    var vm = new Vue({
        el: "#app",
        data: {
            userInfo: {},

            list: [],
            listType: 1,
            listPage: 1,
            listStatus: true,
        },
        methods: {
            init() {
                this.userInfo = get_local("userInfo");
                this.upDownLoad();
                this.getList();
            },
            getList() {
                var that = this;
                var data = {
                    user_id: this.userInfo.user_id,
                    pages: this.listPage
                };
                _ajax(Config.api.UserWalletGetLists, data, function(ret) {
                    if (ret.code === 200) {
                        if (ret.data.length > 0) {
                            that.list = that.list.concat(ret.data);
                        } else {
                            that.listStatus = false;
                        }
                    }
                });
            },
            upDownLoad() {
                var that = this;

                // 下拉刷新
                push_down(function() {
                    //下拉刷新恢复
                    push_down_over();
                    that.listStatus = true;
                    that.listPage = 1;
                    that.list = [];
                    that.getList();
                });

                //上拉加载
                push_up(function() {
                    if (that.listStatus) {
                        that.listPage++;
                        that.getList();
                    }
                });
            },
        }
    });
</script>

</html>
